Skip to content

Conversation

@mpadge
Copy link
Member

@mpadge mpadge commented Oct 27, 2025

Description

@maelle This copies test strategy of srr by adding a helper function to generate a skeleton package.

Example

The skeleton can then be used to make tests like this:

devtools::load_all ()
#> ℹ Loading vcr
path <- vcr_tests_pkg_skeleton()
devtools::document (path)
#> ℹ Updating demo documentation
#> First time using roxygen2. Upgrading automatically...
#> ℹ Setting RoxygenNote to "7.3.3"
#> ℹ Loading demo
#> Writing 'demo-package.Rd'
#> Writing 'test_fn.Rd'
#> Writing 'NAMESPACE'
rd_file <- list.files(file.path(path, "man"), pattern = "test\\_fn", full.names = TRUE)
rd <- tools::parse_Rd (rd_file)
get_Rd_metadata <- utils::getFromNamespace (".Rd_get_metadata", "tools")
rd_exs <- get_Rd_metadata(rd, "examples")
rd_exs
#> [1] "list(\"vcr::insert_example_cassette('test_fn', package = 'demo')\")\n\n\ntest_fn\n\nlist(\"vcr::eject_cassette()\")"

Created on 2025-10-27 with reprex v2.1.1

And test whatever properties you want from rd_exs, which has all of the tags inserted by the roclet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant